package demo2;

public class Test1 {
    public static void main(String[] args) {

    }
}
class Solution {
    public int maxArea(int[] height) {
        int left = 0 ;
        int right = height.length-1 ;
        int sum = 0 ;
        while(left < right){
            int with = right - left ;
            int tmp = with *(height[left] < height[right] ? height[left] : height[right]);
            if(sum < tmp){
                sum = tmp ;
            }
            if(height[left] < height[right]){
                left ++ ;
            }else {
                right -- ;
            }
        }
        return sum ;
    }
}